package com.zsx.shopping.order.enums;

import lombok.Getter;

import java.math.BigDecimal;

public enum DeliveryType {

    ORDINARY((byte) 1, "普通快递送货上门", new BigDecimal(10)),

    EXPRESS((byte) 2, "特快专递", new BigDecimal(20)),

    EXPEDITED_EXPRESS((byte) 3, "加急快递送货上门", new BigDecimal(30)),

    SURFACE_MAIL((byte) 4, "平邮", new BigDecimal(10));

    @Getter
    private Byte id;

    @Getter
    private String method;

    @Getter
    private BigDecimal fare;

    DeliveryType(Byte id, String method, BigDecimal fare) {
        this.id = id;
        this.method = method;
        this.fare = fare;
    }

    public static DeliveryType valueOf(Byte id) {
        DeliveryType[] types = DeliveryType.values();
        for (DeliveryType type : types) {
            if (type.id.equals(id)) {
                return type;
            }
        }
        return null;
    }
}
